﻿namespace 数字化加工图像
{
    using ExifLibrary;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;
    using System.Xml;

    public class Form1 : Form
    {
        private Button button1;
        private Button button2;
        private Button button3;
        private Button button4;
        private Button button5;
        private Button button6;
        private int chenggong;
        private IContainer components;
        private List<string> copy = new List<string>();
        private FolderBrowserDialog folderBrowserDialog1;
        private FolderBrowserDialog folderBrowserDialog2;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private GroupBox groupBox3;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label14;
        private Label label2;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private List<string> liststring = new List<string>();
        private List<object> obj = new List<object>();
        private Panel panel2;
        private ProgressBar progressBar1;
        private int shibai;
        private TextBox textBox1;
        private TextBox textBox10;
        private TextBox textBox11;
        private TextBox textBox12;
        private TextBox textBox13;
        private TextBox textBox14;
        private TextBox textBox15;
        private TextBox textBox16;
        private TextBox textBox2;
        private TextBox textBox3;
        private TextBox textBox4;
        private TextBox textBox5;
        private TextBox textBox6;
        private TextBox textBox7;
        private TextBox textBox8;
        private Panel panel1;
        private Label copyright;
        private TextBox textBox17;
        private Label label3;
        private TextBox textBox18;
        private Label label15;
        private TextBox textBox9;

        public Form1()
        {
            this.InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.textBox1.Text = this.folderBrowserDialog1.SelectedPath;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.textBox2.Text = "";
            this.textBox2.Text = this.textBox2.Text + "开始处理..." + Environment.NewLine;
            try
            {
                DirectoryInfo info = new DirectoryInfo(this.textBox1.Text);
                new DirectoryInfo(this.textBox5.Text);
                int a = 0;
                List<string> fileList = new List<string>();
                fileList = this.files(info, ref a, fileList);
                if (a == 0)
                {
                    this.textBox2.Text = this.textBox2.Text + "不存在需要处理的文件!" + Environment.NewLine;
                    MessageBox.Show("不存在需要处理的文件!");
                }
                else
                {
                    this.textBox2.Text = this.textBox2.Text + "本次需要写入的exif信息(代码):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "标题(270):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "水平分辨率(282):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "垂直分辨率(283):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "分辨率单位(296):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "软件(305):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "厂商(271):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "机型(272):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "修改时间(306):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "数字化时间(36868):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "色彩空间(40961):" + Environment.NewLine;
                    this.textBox2.Text = this.textBox2.Text + "图像压缩率(37122):" + Environment.NewLine;
                    this.progressBar1.Maximum = a;
                    this.ListFiles(this.obj, fileList, this.textBox5.Text);
                    this.progressBar1.Value = 0;
                    this.textBox2.Text = this.textBox2.Text + "完成!" + Environment.NewLine;
                    MessageBox.Show("完成!");
                }
            }
            catch
            {
                this.textBox2.Text = this.textBox2.Text + "确定选择和保存的路径都有效!" + Environment.NewLine;
                MessageBox.Show("确定选择和保存的路径都有效!");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load("exif标准2.21.xml");
                foreach (object obj2 in this.obj)
                {
                    document.SelectSingleNode("//" + ((TextBox) obj2).Name).InnerText = ((TextBox) obj2).Text;
                }
                document.Save("exif标准2.21.xml");
                MessageBox.Show("保存成功!");
            }
            catch
            {
                MessageBox.Show("保存失败!");
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            new Form2(this.liststring).ShowDialog();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (this.folderBrowserDialog2.ShowDialog() == DialogResult.OK)
            {
                this.textBox5.Text = this.folderBrowserDialog2.SelectedPath;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            foreach (string str in this.copy)
            {
                string fileName = Path.GetFileName(str);
                string path = this.textBox1.Text + @"\" + fileName;
                File.Delete(path);
                File.Copy(str, path, true);
                FileInfo info = new FileInfo(str);
                FileInfo info2 = new FileInfo(path) {
                    LastWriteTime = info.LastWriteTime,
                    CreationTime = info.LastWriteTime,
                    LastAccessTime = info.LastAccessTime
                };
            }
            MessageBox.Show("覆盖完成!");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public List<string> files(FileSystemInfo info, ref int a, List<string> fileList)
        {
            if (!info.Exists)
            {
                return null;
            }
            DirectoryInfo info2 = info as DirectoryInfo;
            if (info2 == null)
            {
                return null;
            }
            FileSystemInfo[] fileSystemInfos = info2.GetFileSystemInfos();
            for (int i = 0; i < fileSystemInfos.Length; i++)
            {
                FileInfo info3 = fileSystemInfos[i] as FileInfo;
                if (info3 != null)
                {
                    string extension = Path.GetExtension(info3.FullName);
                    if ((((extension.ToLower() == ".tif") || (extension.ToLower() == ".tiff")) || ((extension.ToLower() == ".jpg") || (extension.ToLower() == ".jpeg"))) || ((extension.ToLower() == ".png") || (extension.ToLower() == ".bmp")))
                    {
                        a++;
                        fileList.Add(info3.FullName);
                        FileInfo info4 = new FileInfo(info3.FullName) {
                            Attributes = FileAttributes.System
                        };
                    }
                }
                else
                {
                    this.files(fileSystemInfos[i], ref a, fileList);
                }
            }
            return fileList;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load("exif标准2.21.xml");
                int y = 10;
                foreach (XmlNode node in document.DocumentElement.ChildNodes)
                {
                    Label label = new Label {
                        Font = new Font("华文行楷", 14.25f, FontStyle.Regular, GraphicsUnit.Point, 0x86),
                        Name = node.Attributes["string"].Value.ToString(),
                        Text = node.Attributes["string"].Value.ToString(),
                        Size = new Size(200, 0x16),
                        Location = new Point(0, y)
                    };
                    this.panel1.Controls.Add(label);
                    y += 0x19;
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        Label label2 = new Label {
                            Name = node2.Attributes["string"].Value.ToString(),
                            Text = node2.Attributes["string"].Value.ToString(),
                            Location = new Point(5, y)
                        };
                        this.panel1.Controls.Add(label2);
                        TextBox box = new TextBox {
                            Size = new Size(0xb9, 0x15),
                            Name = node2.Name,
                            Text = node2.InnerText,
                            Location = new Point(120, y - 2)
                        };
                        this.panel1.Controls.Add(box);
                        y += 0x19;
                        this.obj.Add(box);
                    }
                }
            }
            catch
            {
                MessageBox.Show("加载控件失败!");
            }
        }

        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.textBox3 = new System.Windows.Forms.TextBox();
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.panel2 = new System.Windows.Forms.Panel();
            this.textBox18 = new System.Windows.Forms.TextBox();
            this.label15 = new System.Windows.Forms.Label();
            this.textBox17 = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.textBox16 = new System.Windows.Forms.TextBox();
            this.textBox15 = new System.Windows.Forms.TextBox();
            this.textBox14 = new System.Windows.Forms.TextBox();
            this.textBox13 = new System.Windows.Forms.TextBox();
            this.textBox12 = new System.Windows.Forms.TextBox();
            this.textBox11 = new System.Windows.Forms.TextBox();
            this.textBox10 = new System.Windows.Forms.TextBox();
            this.textBox9 = new System.Windows.Forms.TextBox();
            this.textBox8 = new System.Windows.Forms.TextBox();
            this.textBox7 = new System.Windows.Forms.TextBox();
            this.textBox6 = new System.Windows.Forms.TextBox();
            this.label14 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.copyright = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.button4 = new System.Windows.Forms.Button();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.textBox5 = new System.Windows.Forms.TextBox();
            this.button5 = new System.Windows.Forms.Button();
            this.folderBrowserDialog2 = new System.Windows.Forms.FolderBrowserDialog();
            this.button6 = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.panel2.SuspendLayout();
            this.panel1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.Location = new System.Drawing.Point(786, 10);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(63, 23);
            this.button1.TabIndex = 1;
            this.button1.Text = "浏览..";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // textBox1
            // 
            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox1.Location = new System.Drawing.Point(422, 11);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(362, 21);
            this.textBox1.TabIndex = 2;
            // 
            // textBox2
            // 
            this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox2.Location = new System.Drawing.Point(422, 75);
            this.textBox2.Multiline = true;
            this.textBox2.Name = "textBox2";
            this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.textBox2.Size = new System.Drawing.Size(426, 424);
            this.textBox2.TabIndex = 4;
            // 
            // textBox3
            // 
            this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.textBox3.Location = new System.Drawing.Point(59, 13);
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new System.Drawing.Size(65, 21);
            this.textBox3.TabIndex = 5;
            // 
            // progressBar1
            // 
            this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.progressBar1.Location = new System.Drawing.Point(422, 502);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(344, 73);
            this.progressBar1.TabIndex = 6;
            // 
            // button2
            // 
            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button2.Location = new System.Drawing.Point(766, 501);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(83, 35);
            this.button2.TabIndex = 7;
            this.button2.Text = "执行";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // button3
            // 
            this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button3.Location = new System.Drawing.Point(6, 542);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(402, 23);
            this.button3.TabIndex = 0;
            this.button3.Text = "保存配置信息";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.groupBox1.Controls.Add(this.panel2);
            this.groupBox1.Controls.Add(this.button3);
            this.groupBox1.Controls.Add(this.panel1);
            this.groupBox1.Location = new System.Drawing.Point(2, 6);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(414, 569);
            this.groupBox1.TabIndex = 9;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "添加图像信息";
            // 
            // panel2
            // 
            this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.panel2.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.panel2.Controls.Add(this.textBox18);
            this.panel2.Controls.Add(this.label15);
            this.panel2.Controls.Add(this.textBox17);
            this.panel2.Controls.Add(this.label3);
            this.panel2.Controls.Add(this.textBox16);
            this.panel2.Controls.Add(this.textBox15);
            this.panel2.Controls.Add(this.textBox14);
            this.panel2.Controls.Add(this.textBox13);
            this.panel2.Controls.Add(this.textBox12);
            this.panel2.Controls.Add(this.textBox11);
            this.panel2.Controls.Add(this.textBox10);
            this.panel2.Controls.Add(this.textBox9);
            this.panel2.Controls.Add(this.textBox8);
            this.panel2.Controls.Add(this.textBox7);
            this.panel2.Controls.Add(this.textBox6);
            this.panel2.Controls.Add(this.label14);
            this.panel2.Controls.Add(this.label13);
            this.panel2.Controls.Add(this.label12);
            this.panel2.Controls.Add(this.label11);
            this.panel2.Controls.Add(this.label10);
            this.panel2.Controls.Add(this.label9);
            this.panel2.Controls.Add(this.label8);
            this.panel2.Controls.Add(this.label7);
            this.panel2.Controls.Add(this.label6);
            this.panel2.Controls.Add(this.label5);
            this.panel2.Controls.Add(this.label4);
            this.panel2.Location = new System.Drawing.Point(6, 20);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(402, 545);
            this.panel2.TabIndex = 9;
            // 
            // textBox18
            // 
            this.textBox18.Location = new System.Drawing.Point(148, 336);
            this.textBox18.Name = "textBox18";
            this.textBox18.Size = new System.Drawing.Size(218, 21);
            this.textBox18.TabIndex = 25;
            // 
            // label15
            // 
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(74, 313);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(71, 12);
            this.label15.TabIndex = 24;
            this.label15.Text = "图像优化员:";
            // 
            // textBox17
            // 
            this.textBox17.Location = new System.Drawing.Point(148, 310);
            this.textBox17.Name = "textBox17";
            this.textBox17.Size = new System.Drawing.Size(218, 21);
            this.textBox17.TabIndex = 23;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(98, 339);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(47, 12);
            this.label3.TabIndex = 22;
            this.label3.Text = "操作员:";
            // 
            // textBox16
            // 
            this.textBox16.Enabled = false;
            this.textBox16.Location = new System.Drawing.Point(148, 284);
            this.textBox16.Name = "textBox16";
            this.textBox16.Size = new System.Drawing.Size(218, 21);
            this.textBox16.TabIndex = 21;
            this.textBox16.Text = "内置";
            // 
            // textBox15
            // 
            this.textBox15.Location = new System.Drawing.Point(148, 256);
            this.textBox15.Name = "textBox15";
            this.textBox15.Size = new System.Drawing.Size(218, 21);
            this.textBox15.TabIndex = 20;
            this.textBox15.Text = "65535";
            // 
            // textBox14
            // 
            this.textBox14.Location = new System.Drawing.Point(148, 228);
            this.textBox14.Name = "textBox14";
            this.textBox14.Size = new System.Drawing.Size(218, 21);
            this.textBox14.TabIndex = 19;
            this.textBox14.Text = "2017/5/14 10:20:40";
            // 
            // textBox13
            // 
            this.textBox13.Location = new System.Drawing.Point(148, 200);
            this.textBox13.Name = "textBox13";
            this.textBox13.Size = new System.Drawing.Size(218, 21);
            this.textBox13.TabIndex = 18;
            this.textBox13.Text = "2017/5/12 12:20:40";
            // 
            // textBox12
            // 
            this.textBox12.Location = new System.Drawing.Point(148, 172);
            this.textBox12.Name = "textBox12";
            this.textBox12.Size = new System.Drawing.Size(218, 21);
            this.textBox12.TabIndex = 17;
            this.textBox12.Text = "Avision AT313";
            // 
            // textBox11
            // 
            this.textBox11.Location = new System.Drawing.Point(148, 144);
            this.textBox11.Name = "textBox11";
            this.textBox11.Size = new System.Drawing.Size(218, 21);
            this.textBox11.TabIndex = 16;
            this.textBox11.Text = "Avision";
            // 
            // textBox10
            // 
            this.textBox10.Enabled = false;
            this.textBox10.Location = new System.Drawing.Point(148, 116);
            this.textBox10.Name = "textBox10";
            this.textBox10.Size = new System.Drawing.Size(218, 21);
            this.textBox10.TabIndex = 15;
            this.textBox10.Text = "图像固化系统";
            // 
            // textBox9
            // 
            this.textBox9.Enabled = false;
            this.textBox9.Location = new System.Drawing.Point(148, 88);
            this.textBox9.Name = "textBox9";
            this.textBox9.Size = new System.Drawing.Size(218, 21);
            this.textBox9.TabIndex = 14;
            this.textBox9.Text = "内置";
            // 
            // textBox8
            // 
            this.textBox8.Location = new System.Drawing.Point(148, 60);
            this.textBox8.Name = "textBox8";
            this.textBox8.Size = new System.Drawing.Size(218, 21);
            this.textBox8.TabIndex = 13;
            this.textBox8.Text = "300";
            // 
            // textBox7
            // 
            this.textBox7.Location = new System.Drawing.Point(148, 32);
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new System.Drawing.Size(218, 21);
            this.textBox7.TabIndex = 12;
            this.textBox7.Text = "300";
            // 
            // textBox6
            // 
            this.textBox6.Location = new System.Drawing.Point(148, 4);
            this.textBox6.Name = "textBox6";
            this.textBox6.Size = new System.Drawing.Size(218, 21);
            this.textBox6.TabIndex = 11;
            this.textBox6.Text = "数字化加工项目";
            // 
            // label14
            // 
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(32, 288);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(113, 12);
            this.label14.TabIndex = 10;
            this.label14.Text = "图像压缩率(37122):";
            // 
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(44, 260);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(101, 12);
            this.label13.TabIndex = 9;
            this.label13.Text = "色彩空间(40961):";
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(29, 203);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(113, 12);
            this.label12.TabIndex = 8;
            this.label12.Text = "数字化时间(36868):";
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(56, 228);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(89, 12);
            this.label11.TabIndex = 7;
            this.label11.Text = "修改时间(306):";
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(80, 176);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(59, 12);
            this.label10.TabIndex = 6;
            this.label10.Text = "扫描设备:";
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(80, 148);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(65, 12);
            this.label9.TabIndex = 5;
            this.label9.Text = "厂商(271):";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(80, 120);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(65, 12);
            this.label8.TabIndex = 4;
            this.label8.Text = "软件(305):";
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(44, 92);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(101, 12);
            this.label7.TabIndex = 3;
            this.label7.Text = "分辨率单位(296):";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(44, 64);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(101, 12);
            this.label6.TabIndex = 2;
            this.label6.Text = "垂直分辨率(283):";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(44, 36);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(101, 12);
            this.label5.TabIndex = 1;
            this.label5.Text = "水平分辨率(282):";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(50, 7);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(95, 12);
            this.label4.TabIndex = 0;
            this.label4.Text = "数字化项目名称:";
            // 
            // panel1
            // 
            this.panel1.AutoScroll = true;
            this.panel1.BackColor = System.Drawing.Color.White;
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel1.Controls.Add(this.copyright);
            this.panel1.Enabled = false;
            this.panel1.Location = new System.Drawing.Point(6, 349);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(402, 190);
            this.panel1.TabIndex = 8;
            // 
            // copyright
            // 
            this.copyright.AutoSize = true;
            this.copyright.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.copyright.ForeColor = System.Drawing.Color.Maroon;
            this.copyright.Location = new System.Drawing.Point(65, 91);
            this.copyright.Name = "copyright";
            this.copyright.Size = new System.Drawing.Size(275, 19);
            this.copyright.TabIndex = 0;
            this.copyright.Text = "南京科海智博信息科技有限公司";
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(9, 18);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(47, 12);
            this.label1.TabIndex = 10;
            this.label1.Text = "成功数:";
            // 
            // label2
            // 
            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(135, 18);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(47, 12);
            this.label2.TabIndex = 12;
            this.label2.Text = "忽略数:";
            // 
            // textBox4
            // 
            this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.textBox4.Location = new System.Drawing.Point(185, 13);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(63, 21);
            this.textBox4.TabIndex = 11;
            // 
            // button4
            // 
            this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button4.Location = new System.Drawing.Point(252, 12);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(63, 23);
            this.button4.TabIndex = 13;
            this.button4.Text = "异常报告";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.button4);
            this.groupBox2.Controls.Add(this.textBox4);
            this.groupBox2.Controls.Add(this.textBox3);
            this.groupBox2.Controls.Add(this.label2);
            this.groupBox2.Controls.Add(this.label1);
            this.groupBox2.Location = new System.Drawing.Point(422, 32);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(320, 40);
            this.groupBox2.TabIndex = 14;
            this.groupBox2.TabStop = false;
            // 
            // groupBox3
            // 
            this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox3.Controls.Add(this.textBox5);
            this.groupBox3.Controls.Add(this.button5);
            this.groupBox3.Location = new System.Drawing.Point(748, 32);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(100, 40);
            this.groupBox3.TabIndex = 15;
            this.groupBox3.TabStop = false;
            // 
            // textBox5
            // 
            this.textBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox5.Location = new System.Drawing.Point(6, 13);
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new System.Drawing.Size(30, 21);
            this.textBox5.TabIndex = 18;
            // 
            // button5
            // 
            this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button5.Location = new System.Drawing.Point(38, 12);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(63, 23);
            this.button5.TabIndex = 17;
            this.button5.Text = "保存路径";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            // 
            // button6
            // 
            this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button6.Location = new System.Drawing.Point(766, 535);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(83, 40);
            this.button6.TabIndex = 16;
            this.button6.Text = "覆盖源文件";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.ClientSize = new System.Drawing.Size(849, 577);
            this.Controls.Add(this.button6);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.progressBar1);
            this.Controls.Add(this.textBox2);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "数字化加工图像固化系统";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Load += new System.EventHandler(this.Form1_Load);
            this.groupBox1.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.panel2.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        public void ListFiles(List<object> obj, List<string> fileList, string dirPath)
        {
            string fileName = Path.GetFileName(this.textBox1.Text);
            fileName = this.textBox5.Text + @"\" + fileName + @"\";
            if (!Directory.Exists(fileName))
            {
                Directory.CreateDirectory(fileName);
            }
            this.copy.Clear();
            foreach (string str2 in fileList)
            {
                try
                {
                    this.progressBar1.Value++;
                    string str3 = Path.GetFileName(str2);
                    FileInfo info = new FileInfo(str2);
                    ImageFile file = ImageFile.FromFile(str2);
                    file.Properties.Set(ExifTag.ImageDescription, this.textBox6.Text); //用来描述图像. 双字节的字符码不能使用, 如 中文/韩文/日文.
                    file.Properties.Set(ExifTag.XResolution, double.Parse(this.textBox7.Text));//图像的 显示/打印 分辨率. 缺省值是 1/72英寸, 但是它没有意义因为个人PC在 显示/打印图像的时候不使用这个值.
                    file.Properties.Set(ExifTag.YResolution, double.Parse(this.textBox8.Text)); //图像的 显示/ 打印 分辨率.缺省值是 1 / 72英寸, 但是它没有意义因为个人PC在 显示/ 打印图像的时候不使用这个值.
                    file.Properties.Set(ExifTag.ResolutionUnit, (ushort) 2);//XResolution(0x011a)/YResolution(0x011b)的单位. '1' 表示没有单位, '2'意味着英寸, '3' 表示厘米. 缺省值是 '2'(英寸).
                    file.Properties.Set(ExifTag.Software, this.textBox10.Text);//显示固件的版本号(数字相机的内部控制软件)
                    file.Properties.Set(ExifTag.Make, this.textBox11.Text);//表示数字相机的制造商. 在 Exif 标准中, 这个标签是可选的, 但是在DCF中它是必需的.
                    file.Properties.Set(ExifTag.Model, this.textBox12.Text);//表示数字相机的模块代码. 在 Exif 标准中, 这个标签是可选的, 但在DCF中它也是必需的.
                    file.Properties.Set(ExifTag.DateTime, this.textBox14.Text);//图像修改日期
                    file.Properties.Set(ExifTag.DateTimeDigitized, this.textBox13.Text);//照片创建日期
                    file.Properties.Set(ExifTag.Artist, this.textBox17.Text); //作者
                    //file.Properties.Set(ExifTag.UserComment, "操作员："+this.textBox17.Text+"/图像优化员"+ this.textBox18.Text); //备注
                    file.Properties.Set(ExifTag.UserComment, "00001" ); //备注


                    Image image = file.ToImage();
                    double num = ((image.Height * image.Width) * 3.0) / ((double) info.Length);
                    file.Properties.Set(ExifTag.PixelXDimension, (uint) image.Width);
                    file.Properties.Set(ExifTag.PixelYDimension, (uint) image.Height);
                    image.Dispose();
                    file.Properties.Set(ExifTag.CompressedBitsPerPixel, num);
                    file.Properties.Remove(ExifTag.DateTimeOriginal);
                    file.Save(fileName + str3);
                    FileInfo info2 = new FileInfo(fileName + str3) {
                        LastWriteTime = info.LastWriteTime,
                        CreationTime = info.LastWriteTime,
                        LastAccessTime = info.LastAccessTime
                    };
                    this.copy.Add(fileName + str3);
                    this.chenggong++;
                    this.textBox3.Text = this.chenggong.ToString();
                }
                catch (Exception exception)
                {
                    this.liststring.Add(str2 + ":此文件写入exif信息失败:" + exception.ToString() + Environment.NewLine);
                    this.shibai++;
                    this.textBox4.Text = this.shibai.ToString();
                }
            }
        }
    }
}

